luci-base: give TextValue form elements separate readonly and disabled
authorPaul Donald <[email protected]>
Thu, 3 Jul 2025 15:11:27 +0000 (17:11 +0200)
committerPaul Donald <[email protected]>
Thu, 3 Jul 2025 15:11:27 +0000 (17:11 +0200)
textarea widgets have more value as readonly and not disabled, than
just disabled: you can scroll through them when they're readonly and
not disabled.

So give the form element separate readonly and disabled properties, so
textarea elements defined as readonly with a large amount of content
still cannot be modified, but at least the whole content can be viewed
(because the textarea scrollbars still function).

Signed-off-by: Paul Donald <[email protected]>
modules/luci-base/htdocs/luci-static/resources/form.js

index b6416a044c18aead6b7befb997e267f36c44624d..7d3d2acd74a3d59be99a05be27f197f03876fb1b 100644 (file)
@@ -4601,7 +4601,8 @@ const CBITextValue = CBIValue.extend(/** @lends LuCI.form.TextValue.prototype */
                        rows: this.rows,
                        wrap: this.wrap,
                        validate: L.bind(this.validate, this, section_id),
-                       disabled: (this.readonly != null) ? this.readonly : this.map.readonly
+                       readonly: (this.readonly != null) ? this.readonly : this.map.readonly,
+                       disabled: (this.disabled != null) ? this.disabled : null,
                });
 
                return widget.render();